


// ------------------------------------------------ 倒计时 --------------------------------------- //
var time = 60;
var seconds = time;
function djs(){
	var phone =  $(".text1").val();
	if(checkPhone(phone) == false){
		popup("手机号码有误，请重填");
		return
	}
	if(seconds === 60){
		$.ajax({
			url:"?md=users&cl=users&at=creatCode",
			type:"post",
			dataType:"json",
			data:{"phone":phone},
		});
	}
	if (seconds > 1){
		seconds--;
		$("#bnt_yzm").text("("+seconds+"秒)后可重新获取 ").attr("disabled", true).css("pointer-events","none");
		setTimeout(function(){
			djs();
		},1000);
	}else{
		$("#bnt_yzm").text("免费获取验证码").attr("disabled", false).css('pointer-events','');
		seconds = time;
	}
}


function checkPhone(phone){
	if(!(/^1[3456789]\d{9}$/.test(phone))){
		return false;
	}else{
		return true;
	}
}

$(document).ready(function(){
	//立即注册
	$(".bnt_ljzc").click(function(){
		var text1 = $(".text1").val();
		var text2 = $(".text2").val();
		if(text1==""){
			popup("请填写手机号")
		}else if(text2==""){
			popup("请输入短信验证码")
		}else{
			$.ajax({
				url:"?md=users&cl=users&at=reg",
				type:"post",
				dataType:"json",
				data:{"phone":text1,'checkCode':text2},
				success:function (d) {
					if(d.status == 1){
						popup(d.msg);
						setTimeout(function(){window.location.href = "?md=users&cl=users&at=ordersList";},1500);
					}else{
						popup(d.msg);
						setTimeout(function(){window.location.href = "?md=users&cl=users&at=reg";},1500);
					}
				}
			});
		}
	});


});



/*------------loading---------------*/
document.writeln("<div class=\"loading\"><div class=\"loading_c\"><span><p>加载中...</p></span></div></div>");
function loading(){
	setTimeout(function(){$(".loading").fadeIn();},0);
	setTimeout(function(){$(".loading").fadeOut();},2300);
}

/*------------弹出提示框---------------*/
document.writeln("<div class=\"popup_tsk\"><p></p></div>");
function popup(tsk){
	$(".popup_tsk p").text(tsk);
	$(".popup_tsk").fadeIn();
	setTimeout(function(){$(".popup_tsk").fadeOut()},2000);
}






























